// 采购单
export const purchaseColumns = [
  { width: 200, label: '采购单号', prop: 'order_sn', field: 1 },
  { width: 120, label: '采购方式', prop: 'goods_code', field: 2, slot: true },
  { width: 120, label: '采购员/供应商', prop: 'market', field: 3, slot: true },
  { width: 120, label: '类型', prop: 'type', field: 4, slot: true },
  { width: 120, label: '状态', prop: 'status', field: 5, slot: true },
  { width: 120, label: '采购金额', prop: 'money', field: 6 },
  { width: 120, label: '其他金额', prop: 'other_amount', field: 7 },
  { width: 120, label: '采购合计', prop: 'money_all', field: 8 },
  { width: 200, label: '结算状态', prop: 'footstatus', field: 9, slot: true },
  { width: 120, label: '创建日期', prop: 'created_at', field: 10, slot: true },
  { width: 120, label: '采购日期', prop: 'purchase_time', field: 11, slot: true },
  { width: 160, label: '备注', prop: 'remark', field: 12 },
  { width: 120, label: '采购品种', prop: 'cg', field: 13 },
  { width: 120, label: '已采购品种', prop: 'yc', field: 14 },
  { width: 200, label: '采购进度', prop: 'jd', field: 15, class: "main_hei", slot: true },
  { width: 120, label: '发票类型', prop: 'fp', field: 16, slot: true },
]

export function sortColumns(arr, arr2) {
  // 自定义排序函数
  arr.sort((a, b) => {
    // 获取a和b在sortOrder数组中的索引
    let indexA = arr2.indexOf(a.field);
    let indexB = arr2.indexOf(b.field);
  
    // 根据索引进行比较，如果索引不存在，则将该对象排序到数组末尾
    return indexA === -1 ? 1 : indexB === -1 ? -1 : indexA - indexB;
  });
  return arr
}

//  采购员
export const purchaseBuyerData = {
  columns: [
    { width: 'auto', label: 'ID', prop: 'id' },
    { width: 'auto', label: '名称', prop: 'name' },
    { width: 'auto', label: '手机', prop: 'status', slot: true },
    { width: 'auto', label: '创建时间', prop: 'created_at', slot: true },
  ]
}